<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/common/taglibs.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>系统管理</title>
    <link href="${cdnctx}/dep/jquery/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css"/>
    <%@ include file="/common/util.jsp" %>


    <script type="text/javascript">
        $(document).ready(function () {
            //jumpPage(1);
            for (var i = 1; i < 12; i++) {
                $("#id" + i).removeClass("current");
            }
            $("#id8").addClass("current");

            $("#lightEnergMain").validate({
                rules: {
                    'power': {
                        number: true,
                        maxlength:10
                    }
                },
                messages: {
                    'power': {
                        number: "",
                        maxlength: $.validator.format("功率不得超过{0}位数")
                    }
                }
            })

        });
        function jumpPage(pageIndex) {
            window.location.href = "${cdnctx}/systemDeviceLight/deviceLightList.shtml?pageIndex=" + pageIndex;
        }
        var obj = {
            addDeviceLight: function () {
                window.location.href = "${cdnctx}/systemDeviceLight/deviceLightEdit.shtml";
            },
            updateDeviceLight: function (id) {
                window.location.href = "${cdnctx}/systemDeviceLight/deviceLightEdit.shtml?id=" + id;
            },
            deleteDeviceLight: function (id) {
                dialog_confirmled("确定删除吗？", function () {
                    self.location = "${cdnctx}/systemDeviceLight/delete.shtml?id=" + id;
                });
            }
        }
    </script>
</head>
<body class="main">
<div class="-frame -style -luster" id="css_container">
    <!--首页框架页眉部分↓-->
    <%@ include file="/WEB-INF/pages/inc/header.jsp" %>
    <!--首页框架页眉部分↑-->

    <div class="content">
        <!-- Left导航菜单◎开始 -->
        <%@ include file="/WEB-INF/pages/inc/leftmenu.jsp" %>

        <div class="main-mid">
            <div class="pos"><img src="${cdnctx}/src/index/img/index.png"><a
                    href="<%--${cdnctx}/system/systemMenu.shtml--%>">系统管理 ></a><a
                    href="${cdnctx}/systemDeviceLight/deviceLightList.shtml">灯具能耗表管理</a></div>
            <div class="css_contentDiv">
                <form id="lightEnergMain" action="${cdnctx}/systemDeviceLight/deviceLightList.shtml" method="post">
                    <div class="searchArea b-border-radius" style="padding:10px;">
                        <label class="search_text">灯具番号：</label class="search_text">
                        <input id="lightcode" name="lightcode" type="text"
                               class="search_input" size="15"/>
                        <label class="search_text">灯具名称：</label class="search_text">
                        <input id="lightname" name="lightname" type="text"
                               class="search_input" size="15"/>
                        <label class="search_text">灯具类型：</label class="search_text">
                        <select id="lighttype" name="lighttype" class="search_select">
                            <option value="">--选择--</option>
                            <option value="1">传统灯具</option>
                            <option value="2">LED灯具</option>
                        </select>
                        <label class="search_text">功率：</label class="search_text">
                        <input id="power" name="power" type="text"
                               class="search_input" size="15"/>
                        <input type="submit" class="search_btn" value="查&nbsp;询"/>
                        <input type="reset" class="reset_btn" value="重置"/>
                        <input type="button" class="add_btn" value="新&nbsp;增" onclick="obj.addDeviceLight()"/>
                    </div>
                </form>
                <div class="divTable">
                    <div class="detailDiv">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table">
                            <thead>
                            <tr>
                                <td>灯具番号</td>
                                <td>灯具名称</td>
                                <td>灯具类型</td>
                                <td>功率(w)</td>
                                <td>色温(K)</td>
                                <td>修改者</td>
                                <td>修改时间</td>
                                <td>备注</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <c:if test="${empty(list) }">
                                <tr class="even" align="center" style="color:red">
                                    <td colspan="10" class="no-data" style="height: 300px;"></td>
                                </tr>
                            </c:if>
                            <c:if test="${not empty(list) }">
                                <c:forEach items="${list}" var="entity" varStatus="status">
                                    <tr>
                                        <td>${entity.lightcode}</td>
                                        <td>${entity.lightname}</td>
                                        <td>
                                            <c:if test="${entity.lighttype==1}">传统灯具</c:if>
                                            <c:if test="${entity.lighttype==2}">LED灯具</c:if>
                                        </td>
                                        <td>${entity.power}</td>
                                        <td>${entity.colortemperature}</td>
                                        <td>${entity.modifyby}</td>
                                        <td>${entity.modifydate.toString().substring(0,entity.modifydate.toString().length()-2)}</td>
                                        <td>${entity.memo}</td>
                                        <td>
                                            <input id='newbutton' type='button' class="list_update_btn"
                                                   onclick="obj.updateDeviceLight('${entity.id}')" value='修改'/>
                                                <%--<input id='newbutton' type='button' class="list_delete_btn" onclick="obj.deleteDeviceLight('${entity.id}')" value='删除' />--%>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:if>
                        </table>
                    </div>
                    <c:if test="${not empty(list) }">
                        <div id="pageInfo" class="pageJump">
                            <script type="text/javascript">
                                pagination.getPaginationHtml('JavaScript:jumpPage({0})', ${pageIndex}, ${pageCount}, 'pageInfo');
                            </script>
                            <c:if test="${!empty(list) }">
                                共有${dataCount}条数据
                            </c:if>
                        </div>
                    </c:if>

                </div>
            </div>
        </div>

    </div>

    <!--首页框架页尾部分↓-->
    <%@ include file="/WEB-INF/pages/inc/footer.jsp" %>
    <!--首页框架页尾部分↑-->
</div>
</body>
</html>